From c8abb20560773efb0cd12325aae0483565f56f4d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 19 May 2016 12:09:00 -0700 Subject: [PATCH] Ignore file locks on OSX NFS mounts We already ignore NFS on Linux so let's do the same on OSX as well. --- src/cargo/util/flock.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/cargo/util/flock.rs b/src/cargo/util/flock.rs index 9f6a5352a..cccdd4aad 100644 --- a/src/cargo/util/flock.rs +++ b/src/cargo/util/flock.rs @@ -5,6 +5,8 @@ use std::path::{Path, PathBuf, Display}; use term::color::CYAN; use fs2::{FileExt, lock_contended_error}; +#[allow(unused_imports)] +use libc; use util::{CargoResult, ChainError, Config, human}; @@ -267,6 +269,13 @@ fn acquire(config: &Config, match try() { Ok(()) => return Ok(()), + + // Like above, where we ignore file locking on NFS mounts on Linux, we + // do the same on OSX here. Note that ENOTSUP is an OSX_specific + // constant. + #[cfg(target_os = "macos")] + Err(ref e) if e.raw_os_error() == Some(libc::ENOTSUP) => return Ok(()), + Err(e) => { if e.raw_os_error() != lock_contended_error().raw_os_error() { return Err(human(e)).chain_error(|| { @@ -287,7 +296,6 @@ fn acquire(config: &Config, use std::ffi::CString; use std::mem; use std::os::unix::prelude::*; - use libc; let path = match CString::new(path.as_os_str().as_bytes()) { Ok(path) => path, -- 2.30.2